package orphaned;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.sql.SQLException;

import javax.naming.NamingException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;

public class TestVMServlet extends HttpServlet {


	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

		// 1
//		String stylesheet = "/assets/css/style.css";
//		req.setAttribute("stylesheet", stylesheet);
//		RequestDispatcher requestDispatcher =  req.getRequestDispatcher("/templates/mydoc.vm");
//		requestDispatcher.forward(req, resp);
		
		// 2
//		GoogleBubbleChartUtility gbcu = new GoogleBubbleChartUtility();
//		CheckinUtility cu = new CheckinUtility();
//		
//		TemplateUtility tu = new TemplateUtility("Test page suckers");
//		
//		req.setAttribute("pagetitle", tu.getPageTitle());
//		req.setAttribute("stylesheet", tu.getStyleSheetRef());
//		req.setAttribute("scriptelements", gbcu.getScriptElements());
//		req.setAttribute("divheadcontent", tu.getDivHeadContent());
//		try {
//			req.setAttribute("divcontentcontent", gbcu.getChartContent() + "<br><h2>Latest checkins...</h2>" + cu.getLastCheckinsHTML());
//		} catch (NamingException e) {
//			e.printStackTrace();
//		} catch (SQLException e) {
//			e.printStackTrace();
//		}
//		req.setAttribute("divfootercontent", tu.getDivFooterContent());
//		RequestDispatcher requestDispatcher =  req.getRequestDispatcher("/templates/mydoc.vm");
//		requestDispatcher.forward(req, resp);
		
		TemplateUtility tu = new TemplateUtility("Test Boot Strap");
		req.setAttribute("pagetitle", tu.getPageTitle());
		RequestDispatcher requestDispatcher =  req.getRequestDispatcher("/templates/bstemp.vm");
		requestDispatcher.forward(req, resp);
	}

}